﻿#pragma once

#include <QString>
#include <QMap>
#include "VarDef.h"

class TVarSet
{
public:
	template<typename T>
	void AddRef(T& obj){
		AddPtr(&obj);
	}

	template<typename T>
	void AddPtr(T* pObj){
		Add(TClassName<T>(),pObj);
	}
	template<typename T>
	T* Get() const{
		return (T*)(Get(TClassName<T>()));
	}
private:
	void Add(const QString& name,void* pVar);
	void* Get(const QString& name) const;
private:
	QMap<QString,void*> mVars;
};

